﻿Imports System.Data.OleDb

Public Class AddNewGame
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub BTN_Submit_Click(ByVal sender As Object, ByVal e As EventArgs) Handles BTN_Submit.Click

        If FUP_Image.HasFile Then
            FUP_Image.SaveAs(Server.MapPath("Images") & "/" & FUP_Image.FileName)
            FUP_Gamers_Capture_Img.SaveAs(Server.MapPath("Images") & "/" & FUP_Gamers_Capture_Img.FileName)
        End If


        Dim sql As String = " INSERT INTO GamerZ (GamerZ_Type, Gamerz_Name, User_ID, Gamerz_Publisher, Gamerz_Image, Gamerz_Graphics, Gamerz_Overview, Gamerz_date, Youtube, Gamers_Capture_Img) VALUES (@f1,@f2,@f3,@f4,@f5,@f6,@f7,Now(),@f8,@f9)"
        Dim conn As OleDbConnection = New OleDbConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
        Dim cmd As OleDbCommand = New OleDbCommand(sql, conn)
        cmd.Parameters.AddWithValue("@f1,", DDL_GameType.SelectedValue)
        cmd.Parameters.AddWithValue("@f2,", TB_Name.Text)
        cmd.Parameters.AddWithValue("@f3,", User.Identity.Name)
        cmd.Parameters.AddWithValue("@f4,", TB_Publisher.Text)
        cmd.Parameters.AddWithValue("@f5,", FUP_Image.FileName)
        cmd.Parameters.AddWithValue("@f6,", DDL_Graphic.SelectedValue)
        cmd.Parameters.AddWithValue("@f7,", TB_Overview.Text)
        cmd.Parameters.AddWithValue("@f8,", Youtube.Text)
        cmd.Parameters.AddWithValue("@f9,", FUP_Gamers_Capture_Img.FileName)
        conn.Open()
        cmd.ExecuteNonQuery()
        conn.Close()
        cmd.Dispose()
        conn.Dispose()
        Response.Redirect("Default.aspx")
    End Sub
End Class